---
title: Stage a document and dispatch it to each fax recipient
summary: SendFax end-to-end process on SAIF.Services.WCF.Services.FaxService.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-22
operation_id: OP-014
trigger: Caller invokes `SendFax` over the `Fax` route.
---

# OP-014: Stage a document and dispatch it to each fax recipient

SendFax is invoked over the `Fax` route on `SAIF.Services.WCF.Services.FaxService`; this page documents the process end to end, from route dispatch to the message the caller receives.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-014 |
| **Trigger** | Caller invokes `SendFax` over the `Fax` route. |
| **Entry operation** | [`SendFax`](../contracts/fax-service.md#sendfax) |
| **Owning component** | `SAIF.Services.WCF.Services.FaxService.SendFax` |
| **Inputs** | Request message parts listed below |
| **Outputs** | No response payload (void) |
| **Failure behavior** | Generic SOAP fault, per [Faults and error pipeline](../faults.md) |

## Request and response

| Direction | Element | Type | Declared in | Notes |
| --- | --- | --- | --- | --- |
| Request | `config` | `SAIF.Core.Services.Documents.FaxConfig` | External contracts assembly (`SAIF.Services.WCF.Contracts` / framework closure) ** | Fax request carrying the document bytes and the recipient collection. (Yes) |
| Response | `void` | `void` | n/a (void) | Not applicable. |

<!-- Types declared in `SAIF.Services.WCF.Contracts` are attributed to `SAIF.Framework.Core`, inferred from source and package references and marked `*`; their members are not enumerated because the external declaration was not read, marked `**`. -->

## Steps

1. Constructor resolves `EnvironmentConfigKeys.FaxSoapServiceUrl` and `EnvironmentConfigKeys.FaxTempStorageFolder`, constructs `FaxServiceProxy` and a `FileService` ([BR-WCF-002](../business-rules.md#br-wcf-002-per-request-configuration-and-connection-resolution), [BR-WCF-019](../business-rules.md#br-wcf-019-fax-proxy-requires-a-resolved-service-url)).
2. `Enforce.ArgumentNotNull(config)` and `Enforce.ArgumentNotNull(config.Recipients)` ([BR-WCF-020](../business-rules.md#br-wcf-020-sendfax-requires-a-config-and-recipients)).
   - On failure: `ArgumentNullException`, logged and surfaced as a generic SOAP fault.
3. Generate a GUID file name and concatenate it onto the configured temp folder, assuming the folder ends in a separator rather than using `Path.Combine` ([BR-WCF-021](../business-rules.md#br-wcf-021-fax-document-is-staged-then-deleted)).
4. Delegate to `FileService.WriteFile` to materialize `config.File` at that path ([BR-WCF-004](../business-rules.md#br-wcf-004-file-operations-trust-the-caller-supplied-path)).
   > **Origin**: This step is implemented in [`WriteFile`](file-writefile.md) and executed within this operation.
5. For each recipient in `config.Recipients`, call `FaxServiceProxy.SendFax(recipient, fullFilePath)`, which builds a `FaxInfo` (`Attachment`, `ToFaxNumber`, `ToName`) and invokes the Legacy.Fax `Send` operation over `BasicHttpBinding` with `TransportCredentialOnly`/`Windows` ([BR-WCF-022](../business-rules.md#br-wcf-022-one-fax-dispatched-per-recipient)).
   - On failure mid-loop: the downstream `FaultException`/`CommunicationException`/`TimeoutException` propagates, is logged by the installed error handler, and is surfaced as a generic SOAP fault; recipients already sent are not compensated.
6. Delegate to `FileService.DeleteFile` to remove the temporary file; because this is not in a `finally`, a fault at the previous step leaves the file behind ([BR-WCF-021](../business-rules.md#br-wcf-021-fax-document-is-staged-then-deleted)).
   > **Origin**: This step is implemented in [`DeleteFile`](file-deletefile.md) and executed within this operation.
7. Return.

## Process flow

The following diagram visualizes this process's control flow.

```mermaid
flowchart TD
    A["Resolve fax config and<br>construct FaxServiceProxy/FileService"]
    B["Validate config and recipients"]
    C["Generate temp file path"]
    D["Write document to temp file"]
    E["Send fax to each recipient"]
    F["Delete temp file"]
    G["Return."]
    A --> B
    B --> C
    C --> D
    D --> E
    E --> F
    F --> G
```

## Transaction and side effects

| Aspect | Finding |
| --- | --- |
| Unit of work | None |
| Commit point | Not applicable — no unit of work is opened |
| Records written | None |
| Downstream calls | Legacy.Fax SOAP service (one call per recipient) — see [Dependencies](../dependencies.md) |
| Shared state touched | None |
| Repeat-call behavior | Each call restages and redispatches the fax; not idempotent, and a duplicate call resends to every recipient |

## Logging

| Surface | Written content |
| --- | --- |
| `ErrorLogErrorHandler` → `LogService` | Failure-path exception logging only, carrying method signature, calling user and exception detail; see [Faults and error pipeline](../faults.md) |

## Faults and error handling

| Failure | Fault type the caller receives | Produced by | Source |
| --- | --- | --- | --- |
| `ArgumentNullException` | `Generic SOAP fault` | The operation itself, via `Enforce` | src/WCF/SAIF.Services.WCF.Host/Services/FaxService.cs |
| `FaultException`/`CommunicationException`/`TimeoutException` from Legacy.Fax | `Generic SOAP fault` | The `ErrorLogErrorHandler` installed by `[LogErrorBehavior]` | src/WCF/SAIF.Services.WCF.Host/Services/LegacyProxies/FaxServiceProxy.cs |
| Filesystem exception staging or removing the temp file | `Generic SOAP fault` | The `ErrorLogErrorHandler` installed by `[LogErrorBehavior]` | src/WCF/SAIF.Services.WCF.Host/Services/FileService.cs |

## Authorization

| Requirement | Enforced by | Source | Applies to |
| --- | --- | --- | --- |
| [None in code](../authentication-authorization.md#authorization-enforcement) | IIS authentication on the deployment (see [Activation and hosting](../activation-hosting.md)) | `src/WCF/SAIF.Services.WCF.Host/Services/FaxService.cs` | This operation |

## Related documentation
- [Index](../index.md)
- [Overview](../overview.md)
- [Architecture](../architecture.md)
- [Activation and hosting](../activation-hosting.md)
- [Operations](../operations.md)
- [Faults and error pipeline](../faults.md)
- [Authentication and authorization](../authentication-authorization.md)
- [Dependencies](../dependencies.md)
- [Configuration](../configuration.md)
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [Data model](../data-model.md)
- [Operational runbook](../operational-runbook.md)
- [Tech debt](../tech-debt.md)

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts. Statements marked with `**` could not be confirmed; treat
> as unknown until verified.

## Sources
- src/WCF/SAIF.Services.WCF.Host/Services/FaxService.cs
- src/WCF/SAIF.Services.WCF.Host/Services/FileService.cs
- src/WCF/SAIF.Services.WCF.Host/Services/LegacyProxies/FaxServiceProxy.cs
